package com.enlorenz.core.queue.proc;

import com.enlorenz.core.queue.transfer.imp.NoWaitMessageQueue;

/**
 * 睡眠循环线程管理类
 * 获取单个对象
 * @author lcb
 */
public abstract class AbstractObjectCycleSleepThread<T> extends AbstractRecvDriveSleepThread{
	private NoWaitMessageQueue<T> noWaitMessageQueue;
	/**
	 * 设置无等待队列对象
	 * @param noWaitMessageQueue 无等待队列对象
	 */
	public void setNoWaitMessageQueue(NoWaitMessageQueue<T> noWaitMessageQueue) {
		this.noWaitMessageQueue = noWaitMessageQueue;
	}

	/**
	 * 处理接收到的结果
	 * @param resultList
	 */
	protected abstract void process(T result);

	@Override
	protected Object getRecvMsg() {
		T message = noWaitMessageQueue.getMsg();
		return message;
	}

	@SuppressWarnings("unchecked")
	@Override
	protected void trans2Imp(Object object) {
		process((T)object);
	}
	
}
